<?php
declare (strict_types = 1);

namespace app\common\service;

use app\common\components\Mail;

class MailService  extends \think\Service
{

    /**
     * 注册服务
     *
     * @return mixed
     */
    public function register()
    {
        return $this->app->bind('mail', Mail::class);
    }

    
    /**
     * 执行服务
     *
     * @return mixed
     */
    public function boot()
    {
        // 163邮箱的ssl协议方式端口号是465/994、非ssl 端口号25
        Mail::setHostAndPort(config('service.mail.host'),config('service.mail.port'));
        //Mail::setEncryption('ssl');
        Mail::setUsernameAndPassword(config('service.mail.username'),config('service.mail.password'));
    }
}
